package com.chenshu.shop.mapper;

import com.chenshu.shop.model.Cart;
import com.chenshu.shop.model.Item;
import com.chenshu.shop.model.Order;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * Created with IntelliJ IDEA
 * Description
 * User：chenshu
 * Date：2024-06-07
 * Time：10:52
 */
@Mapper
public interface OrderMapper {
    public List<Order> getAllOrders(@Param("status") Integer status,
                                    @Param("begin") Integer begin,
                                    @Param("end") Integer end);
    public List<Item> getItemsByOrderId(Integer orderId);

    public Integer getOrderCount(Integer status);

    public Integer updateOrderStatus(@Param("id") Integer id, @Param("status") Integer status);

    public Integer getOrderRow(@Param("id") Integer orderId, @Param("status") Integer status);

    public Integer deleteOrder(Integer id);

    public Order getOrderById(Integer id);

    public Integer insertOrder(Order order);

    public List<Cart> getCartsByUserId(Integer userId);

    public Integer insertItems(Item item);

    public Integer updateOrderTotal(@Param("total") int total, @Param("orderId") Integer orderId);

    public Integer clearCart(Integer userId);

    public List<Order> getAllOrdersById(@Param("userId") Integer userId,
                                        @Param("begin") Integer begin,
                                        @Param("end") Integer end);

    public Integer getCountByUserId(Integer userId);

    public Integer updateOrderInfo(Order order);
}
